<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Open Informix server connection</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ifx-connect" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ifx_connect</h1>
  <p class="verinfo">(PHP 4, PHP 5 &lt; 5.2.1)</p><p class="refpurpose"><span class="refname">ifx_connect</span> &mdash; <span class="dc-title">Open Informix server connection</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ifx-connect-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ifx_connect</strong></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$database</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$userid</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$password</code></span>
  ]]] ) : <span class="type">resource</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>ifx_connect()</strong></span> establishes a connection to an Informix
   server.  
  </p>
  <p class="para">
   In case a second call is made to <span class="function"><strong>ifx_connect()</strong></span> with the
   same arguments, no new link will be established, but instead, the link
   identifier of the already opened link will be returned.
  </p>
  <p class="para">
   The link to the server will be closed as soon as the execution of the
   script ends, unless it&#039;s closed earlier by explicitly calling
   <span class="function"><a href="ifx_close.html" class="function">ifx_close()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ifx-connect-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   All of the arguments are optional, and if they&#039;re missing, defaults are
   taken from values supplied in <var class="filename">php.ini</var> (ifx.default_host for the host
   (Informix libraries will use <var class="envar">INFORMIXSERVER</var> environment
   value if not defined), ifx.default_user for user, ifx.default_password for
   the password (none if not defined).
  </p>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">database</code></dt>

     <dd>

      <p class="para">
       The database name, as a string.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">userid</code></dt>

     <dd>

      <p class="para">
       The username, as a string.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">password</code></dt>

     <dd>

      <p class="para">
       The password, as a string.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ifx-connect-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a connection identifier on success, or <strong><code>FALSE</code></strong> on error.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ifx-connect-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-1284">
    <p><strong>Example #1 Connect to a Informix database</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$conn_id&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ifx_connect&nbsp;</span><span style="color: #007700">(</span><span style="color: #DD0000">"mydb@ol_srv1"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"imyself"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"mypassword"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ifx-connect-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="ifx_pconnect.html" class="function" rel="rdfs-seeAlso">ifx_pconnect()</a> - Open persistent Informix connection</span></li>
    <li class="member"><span class="function"><a href="ifx_close.html" class="function" rel="rdfs-seeAlso">ifx_close()</a> - Close Informix connection</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>